package org.jeecg.modules.basedata.mapper;
import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.entity.basedata.BaseRoom;
import org.jeecg.entity.basedata.RoomVo;
import org.jeecg.modules.system.model.SysDepartTreeModel;
import org.jeecg.vo.basedata.BaseRoomPage;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.model.TreeModel;

import java.util.List;

/**
 * @Description: 房间
 * @Author: jeecg-boot
 * @Date:   2019-07-03
 * @Version: V1.0
 */
public interface BaseRoomMapper extends BaseMapper<BaseRoom> {

    public BaseRoomPage selectByMainId(String mainId);

    public List<SysDepart> queryFloorTreeList();

    List<TreeModel> findRoomTreeList(@Param("baseRoom")BaseRoom baseRoom);

    List<SysDepart> queryRoomTreeList(@Param("baseRoom") BaseRoom baseRoom);

    public void updateRoomStatus(@Param("upRoomId") String upRoomId,@Param("upRoomStatus") String upRoomStatus);

    public void syupdateRoomStatus(String syRoomId);

    public List<BaseRoom> getByRoomIds(@Param("roomIds") String [] roomIds);

    @SqlParser(filter = true)
    public BaseRoom getByBaseRoom(String id);

    List<BaseRoom> listByParams(@Param("page") Page<BaseRoom> page, @Param("baseRoom")BaseRoom  baseRoom);

    public Integer getPeopeleCount(String id);

    public Integer getPeopeleCounts(@Param("ids") String[] ids);

    public List<RoomVo> getByFloorId(@Param("floorId") String floorId);
    @Select("select name from base_room where floor_id =#{floorId} AND name =#{roomNmae} and del_flag='0'")
    String queryRoomName(@Param("floorId") String floorId,@Param("roomName")String roomName);


    BaseRoom getBaseRoomByName(@Param("roomName") String roomName,@Param("floorId") String floorId);

    void updateBatchRoomStatus(@Param("roomList") List<BaseRoom> roomList);

    List<BaseRoom> getByRentStatus(@Param("floorId") String floorId,@Param("rentStatus") Integer rentStatus);

    BaseRoom getByFloorIdName(@Param("floorId") String floorId,@Param("name") String name);
    @Select("select count(0) from base_room where floor_id = #{floorId} and name = #{name} and del_flag= '0'")
    Integer checkRoomName(@Param("name") String name,@Param("floorId") String floorId);

    String getRoomAddress(@Param("roomId")String id);

    List<String> getAllFeeItemId(@Param("roomIds") List<String> roomId);

    void updateSpiltDate(@Param("baseRoom") BaseRoom baseRoom);

    Page<BaseRoom> queryRoomFeeList(@Param("page") Page<BaseRoom> page, @Param("baseRoom")BaseRoom  baseRoom);


    Page<BaseRoom> getRoomList(@Param("page") Page<BaseRoom> pageList, @Param("projectId") String projectId,@Param("feeRuleId") String feeRuleId,@Param("roomId")String roomId,@Param("floorId")String floorId);

    void updateBatchRoomName(@Param("roomList") List<BaseRoom> roomList,@Param("baseRoom")BaseRoom baseRoom);


}
